<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<%@ taglib prefix="uct" uri="/WEB-INF/uct.tld" %>
<%@ page import="com.apache.uct.common.ToolsUtil" %>
<%@ page import="com.apache.client.UctCoreClient" %>
<%

	String uct_server = ToolsUtil.getInstance().getClientValueByKey("uct_server");
	String login_out_url=ToolsUtil.getInstance().getClientValueByKey("login_out_url");
	if(login_out_url==null||"".equals(login_out_url)){//如果本地为空 则从用户中心统一配置获取退出路径
		login_out_url=UctCoreClient.getConf_Map().get("login_out_url");
	}

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>后台管理系统</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
        <link rel="stylesheet" id="easyuicssId" type="text/css" href="${ctx}/widgets/jquery-easyui/themes/default/easyui.css">
        <link rel="stylesheet" type="text/css" href="${ctx}/widgets/jquery-easyui/themes/icon.css">
        <script type="text/javascript" src="${ctx}/widgets/jquery-easyui/jquery-1.6.min.js">
        </script>
        <script type="text/javascript" src="${ctx}/widgets/jquery-easyui/jquery.easyui.min.js">
        </script>
        <style type="text/css">
            h3 {
                width: 95%;
                border: 1px solid #eee;
                margin: 2px;
                margin-left: 2px;
                height: 20px;
                font-size: 12px;
                font-weight: normal;
                line-height: 20px;
                vertical-align: center;
                text-indent: 5px;
                cursor: pointer;
            }
			.icon-theme{
				background:url('${ctx}/widgets/jquery-easyui/extend/images/theme2.png') no-repeat;
			}
			
			.tree-node-selected {
				    background: none repeat scroll 0 0 #FFFFFF;
			}

        </style>
        <script type="text/javascript">
           $(function(){
             //alert('${loginUser}'); 
           });
        
        	//关闭进度条
			function closes(){
				$("#Loading").fadeOut("normal",function(){
					$(this).remove();
				});
			}
			var pc;
			$.parser.onComplete = function(content){
				if(pc) clearTimeout(pc);
				pc = setTimeout(closes, 1000);
			}
			
			//主题预览
			function themeView(){
				$("#themeView").window('open');
			}
			
			//切换主题
			function switchTheme(id){
				var cxt="${ctx}/widgets/jquery-easyui/themes/";
				var end = "/easyui.css";
				var classPath = cxt+id+end;
				$("#easyuicssId").attr('href',classPath);
				//$("#themeimgId").attr('src',"${ctx}/widgets/jquery-easyui/extend/images/"+id+".jpg");
			}
			
            var maxWindow = 10;
            $(function(){
                var p = $('body').layout('panel', 'west').panel({
                    onCollapse: function(){
                        //alert('collapse');
                    }
                });
				
				//主题列表树
				$("#themeListTree").tree({
					onClick:function(node){
						//alert(node.id);
						switchTheme(node.id);
					}
				});
                
                //主tab面板
                $('#main').tabs({
                    onSelect: function(){
                        var tab = $('#main').tabs('getSelected');
                        //alert(tab.iframe);						
                    },
                    tools: [{
							text:'主题',
							iconCls:'icon-theme',
							handler:themeView
						},{
                        iconCls: 'icon-help',
                        handler: function(){
                            help();
                            //window.location.href='index.html';
                        }
                        
                    }]
                });
                var content = '<iframe scrolling="auto" frameborder="0"  src="${ctx}/widgets/jquery-easyui/extend/about.html" style="width:100%;height:100%;"></iframe>';
                $('#main').tabs('add', {
                    title: "简绍",
                    content: content,
                    closable: false
                });
                
                tabCloseEven();
            });
            
            function addTab(title, url){
                var tabslength = $('#main').tabs('tabs').length;
                if (tabslength < maxWindow) {
                    if ($('#main').tabs('exists', title)) {
                        $.messager.confirm('确认', '确定要刷新标签页： <font color=red>' + title + '</font> 吗?', function(flag){
                            if (flag) {
                                var content = '<iframe scrolling="auto" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
                                var tab = $('#main').tabs('getTab', title);
                                $('#main').tabs('update', {
                                    tab: tab,
                                    options: {
                                        title: title,
                                        content: content,
                                        closable: true
                                    }
                                });
                                $('#main').tabs('select', title);
                            }
                        });
                        //$('#main').tabs('close',title);
                    }
                    else {
                        var content = '<iframe scrolling="auto" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
                        $('#main').tabs('add', {
                            title: title,
                            content: content,
                            closable: true
                        });
                    }
                }
                else {
                    $.messager.alert('信息提示', "您打开窗口太多了,请关闭不用的窗口!", 'info', function(){
                        return false;
                    });
                }
                
                $(".tabs-inner").dblclick(function(){
                    var ti = $(this).children("span").text();
                    if (ti != '简绍') {
                        $('#main').tabs('close', ti);
                    }
                });
                
                $(".tabs-inner").bind('contextmenu', function(e){
                    $('#mm').menu('show', {
                        left: e.pageX,
                        top: e.pageY
                    });
                    var subtitle = $(this).children("span").text();
                    $('#main').data("currtab", subtitle);
                    return false;
                });
            }
            
            function select(){
                $('#leftmenu').accordion('select', 'Title1');
            }
            
            
            function help(){
                $.messager.alert('信息提示', "双击关闭tab页!", 'info');
            }
            
            
            /**关闭tab标签页*/
            function closeTab(){
                var tab = parent.$('#main').tabs('getSelected');
                var tname = tab.panel('options').title;
                parent.$('#main').tabs('close', tname)
            }
        </script>
        
	
	<!-- 2013年1月10日20:23:37修改 -->
	<script type="text/javascript">
		/**有父窗口则在父窗口打开*/
	if (self != top) {
		top.location = self.location;
	}
//修改密码
function updatePwd(){
	//addTab2('修改密码','zbxapp/common/update-pwd.action')
	// 进入增加页面
			$('#saveFrame').html('');			
			var url = '<%=uct_server %>/common/update-pwd.action';				
			$('#saveFrame').attr("title",'');
			$('#saveFrame').attr("src",url);
			$('#saveDiv').window('open');			
}
//关闭密码
function closePasWin(){
	$('#saveDiv').window('close');		
}


function addTab2(title,url) {
	addTabBase(title,url);
}

function addTabBase(title,url) {
	if ($('#main').tabs('exists', title)) {
		$('#main').tabs('close', title);
	}

	var content = '<iframe scrolling="auto" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
	$('#main').tabs('add', {
		title : title,
		iconCls : '',
		content : content,
		closable : true
	});

}
function logout(){
	$.messager.confirm('提示', '您确定工作已经保存，并退出该系统?', function(r){
			if (r){
				location.href = '${ctx}/logout?go=<%=login_out_url%>';
			}
	   });
}

	</script>

    </head>
    <body class="easyui-layout">
        <div id='Loading' style="position:absolute;z-index:1000;top:0px;left:0px;width:100%;height:100%;background:#DDDDDB;text-align:center;padding-top: 20%;">
            <h1>
                <font color="#15428B">
                 	页面初始化中，请等待....
                </font>
            </h1>
        </div>

        
        <!-- 2013年1月10日20:23:05 修改 -->
        	<!-- 添加窗口 -->
	<div id="saveDiv" class="easyui-window" title="修改密码" style="padding:5px;width: 500px;height:250px;"
    	iconCls="icon-search" closed="true" maximizable="false" minimizable="false" collapsible="false">
   		<iframe frameborder="0"  id="saveFrame" height="100%" width="100%" scrolling="No" frameborder="0" ></iframe>
    </div>
        
        
        
        <style>
        	.top{ height: 66px; background-image: url(images/bg02.jpg); top repeat-x;position:relative;}
        </style>
        <div id="top" class="top" region="north" border="false">
			<img src="images/logo.png" style="float:left;height:65px; width:100px;padding-left:50px;"/><span style="float:left; line-height:66px;font-size:30px;font-family:微软雅黑; color:#000000;text-shadow:5px 5px 5px #0c4b09 ">
			工作流系统v1.3.0.4748</span>
			<span style="float: right; padding: 4px;"> 
			<font color="#9282;">欢迎您：${loginUser.userCname}|</font>

			<font color="#ddeeff"> <a href="#" onclick="updatePwd();" style="text-decoration:none ;color:#9282;">修改密码</a></font>
			<font color="#ddeeff">|</font>
			<font color="#ddeeff"><a href="#" onclick="logout();" style="text-decoration:none ;color:#9282;">退出系统</a></font>
			</span>
		</div>
		
		
        <div region="west" split="true" title="功能扩展菜单" style="width:210px;padding:0px;">
            <div id="leftmenu" class="easyui-accordion" fit="true" border="false">
<%--                 <uct:uctTag actFullEname="/flow/flow_flowManager">--%>
					<div title="流程管理" iconCls="icon-undo">
					   <%--  <uct:uctTag actFullEname="/flow/flow_flowManager/flow_flowDefinitionOper"> --%>
							<h3 onclick="addTab('流程定义管理All','${ctx}/flow/core/flow-deploy.action?operType=operator','icon-user')">流程定义管理All</h3>
						<%-- </uct:uctTag> --%>
<%--						<uct:uctTag actFullEname="/flow/flow_flowManager/flow_flowDefinition">--%>
							<h3 onclick="addTab('流程定义管理','${ctx}/flow/core/flow-deploy.action','icon-user')">流程定义管理</h3>
<%--						</uct:uctTag>--%>
<%--						<uct:uctTag actFullEname="/flow/flow_flowManager/flow_flowInstance">--%>
							<h3 onclick="addTab('流程实例管理','${ctx}/flow/core/flow-instance.action','icon-org')">流程实例管理</h3>	
<%--						</uct:uctTag>--%>
<%--					<uct:uctTag actFullEname="/flow/flow_flowManager">--%>
						<h3 onclick="addTab('自处理任务管理','${ctx}/flow/core/flow-automatic.action','icon-org')">自处理任务管理</h3>	
<%--					</uct:uctTag>--%>
					</div>
<%--				</uct:uctTag>--%>
				
<%--				<uct:uctTag actFullEname="/flow/flow_flowInfoManager">--%>
					<div title="工作流信息管理" iconCls="icon-undo">
						<%-- <uct:uctTag actFullEname="/flow/flow_flowInfoManager/flow_systemReg">
							<h3 onclick="addTab('工作流系统注册','${ctx}/flow/system/flow-sys.action','icon-role')">工作流系统注册</h3>
						</uct:uctTag> --%>
<%--						<uct:uctTag actFullEname="/flow/flow_flowInfoManager/flow_lock">--%>
							<h3 onclick="addTab('工作流资源管理','${ctx}/flow/task_url/flow-task-url.action','icon-sys')">工作流资源管理</h3>	
<%--						</uct:uctTag>--%>
					</div>
<%--				</uct:uctTag>--%>
				
<%--				<uct:uctTag actFullEname="/flow/flow_historyManager">--%>
					<div title="流程历史管理" iconCls="icon-undo">
<%--						<uct:uctTag actFullEname="/flow/flow_historyManager/flow_instanceLog">--%>
							<h3 onclick="addTab('流程实例日志','${ctx}/flow/core/flow-his-instance.action','icon-user')">流程实例日志</h3>	
<%--						</uct:uctTag>--%>
<%--						<uct:uctTag actFullEname="/flow/flow_historyManager/flow_activeLog">--%>
							<h3 onclick="addTab('流程活动日志','${ctx}/flow/core/flow-his-activity.action','icon-user')">流程活动日志</h3>
<%--						</uct:uctTag>--%>
<%--						<uct:uctTag actFullEname="/flow/flow_historyManager/flow_taskLog">--%>
							<h3 onclick="addTab('流程任务日志','${ctx}/flow/core/flow-his-task.action','icon-user')">流程任务日志</h3>
<%--						</uct:uctTag>--%>
<%--						<uct:uctTag actFullEname="/flow/flow_historyManager/flow_detailLog">--%>
							<h3 onclick="addTab('流程Detail日志','${ctx}/flow/core/flow-his-detail.action','icon-user')">流程Detail日志</h3>
<%--						</uct:uctTag>--%>
					</div>
<%--				</uct:uctTag>--%>
				
				<%-- <uct:uctTag actFullEname="/flow/flow_test">
					<div title="流程测试请假单" iconCls="icon-undo">
						<uct:uctTag actFullEname="/flow/flow_test/flow_checkLeaveFlow">
							<h3 onclick="addTab('请假流程审批','${ctx}/flow/core/flow-task.action','icon-dict')">请假流程审批</h3>	
						</uct:uctTag>
						<uct:uctTag actFullEname="/flow/flow_test/flow_startLeaveFlow">
							<h3 onclick="addTab('填写请假单','${ctx}/flowapp/business/flow-leave!init.action?definitionId=process001-1','icon-dict')">填写请假单</h3>	
						</uct:uctTag>
					</div>
            	</uct:uctTag> --%>
            	<div title="流程测试" iconCls="icon-undo">
            			<h3 onclick="addTab('待办任务查询','${ctx}/flow/test/test-task-list.action','icon-dict')">待办任务查询</h3>	
						<h3 onclick="addTab('按钮级测试控制台','${ctx}/flow/test/test-console.action','icon-dict')">按钮级测试控制台</h3>	
				</div>
            </div>
        </div>
        <div id="ccc" region="center" title="" border="false">
            <div id="main">
            </div>
        </div>
        <script type="text/javascript">
            var bodyh = $(window).height();
            var toph = $('#top').height();
            var mainh = bodyh - toph;
            $('#main').height(mainh);
            
            function tabCloseEven(){
                //关闭当前
                $('#mm-tabclose').click(function(){
                    var tt = $('#main').data("currtab");
                    $('#main').tabs('select', tt);
                    if (tt != '简绍') {
                        $('#main').tabs('close', tt);
                    }
                })
                //全部关闭
                $('#mm-tabcloseall').click(function(){
                    var tt = $('#main').data("currtab");
                    $('#main').tabs('select', tt);
                    
                    $('.tabs-inner span').each(function(i, n){
                        var t = $(n).text();
                        if (t != '简绍') {
                            $('#main').tabs('close', t);
                        }
                    });
                });
                //关闭除当前之外的TAB
                $('#mm-tabcloseother').click(function(){
                    var tt = $('#main').data("currtab");
                    $('#main').tabs('select', tt);
                    
                    $('.tabs-inner span').each(function(i, n){
                        var t = $(n).text();
                        if (t != tt && t != '简绍') {
                            $('#main').tabs('close', t);
                        }
                    });
                });
                //关闭当前右侧的TAB
                $('#mm-tabcloseright').click(function(){
                    var tt = $('#main').data("currtab");
                    $('#main').tabs('select', tt);
                    
                    var nextall = $('.tabs-selected').nextAll();
                    if (nextall.length == 0) {
                        $.messager.alert('信息提示', "到头了，后边没有啦~~", 'info', function(){
                            return false;
                        });
                    }
                    nextall.each(function(i, n){
                        var t = $('a:eq(0) span', $(n)).text();
                        if (t != '简绍') {
                            $('#main').tabs('close', t);
                        }
                    });
                    return false;
                });
                //关闭当前左侧的TAB
                $('#mm-tabcloseleft').click(function(){
                    var tt = $('#main').data("currtab");
                    $('#main').tabs('select', tt);
                    
                    var prevall = $('.tabs-selected').prevAll();
                    if (prevall.length <= 1) {
                        $.messager.alert('信息提示', "【简绍】不能关了啊~", 'info', function(){
                            return false;
                        });
                    }
                    prevall.each(function(i, n){
                        var t = $('a:eq(0) span', $(n)).text();
                        if (t != '简绍') {
                            $('#main').tabs('close', t);
                        }
                    });
                    return false;
                });
            }
        </script>
        <div id="mm" class="easyui-menu" style="width:150px;">
            <div id="mm-tabclose">
                关闭
            </div>
            <div id="mm-tabcloseall">
                全部关闭
            </div>
            <div id="mm-tabcloseother">
                除此之外全部关闭
            </div>
            <div class="menu-sep">
            </div>
            <div id="mm-tabcloseright">
                当前页右侧全部关闭
            </div>
            <div id="mm-tabcloseleft">
                当前页左侧全部关闭
            </div>
        </div>
		<div id="themeView" iconCls="icon-theme" class="easyui-window" title="主题设置" closed="true" style="height:380px;width:600px;">
		<div class="easyui-layout" style="height:100%;width:100%;">
			<div region="west" title="主题列表" style="width:115px;height:300px;">
				<ul id="themeListTree" class="easyui-tree">
					<li select="true" id="default">默认default</li>
					<li id="gray">灰色gray</li>
					<li id="green">绿色green</li>
					<li id="red">艳红色red</li>		
				</ul>
			</div>
			<div region="center" title="主题预览">
<%--				<img src="${ctx}/widgets/jquery-easyui/extend/images/default.jpg" id="themeimgId" style="height:100%;width:100%;"/>				--%>
			</div>
		</div>
	</div>
    </body>
</html>
